package com.le.t1;

import com.le.t1.jie.imp.personjimp;

import java.io.IOException;
import java.io.ObjectOutputStream;
import java.net.InetAddress;
import java.net.Socket;
import java.util.ArrayList;
import java.util.List;

public class Serverdl {
    com.le.t1.jie.personj personj=new personjimp();
    ObjectOutputStream os;
    InetAddress serverIP;
    Socket socket;
    List<person> persons=new ArrayList<>();
    public  Serverdl() {

            try {


                    serverIP = InetAddress.getByName("127.0.0.1");
                    socket = new Socket(serverIP, 7777);
                    os = new ObjectOutputStream(socket.getOutputStream());
                    persons = personj.select();

                    os.writeObject(persons);





            } catch (IOException e) {
                e.printStackTrace();
            } catch (Exception e) {
                e.printStackTrace();
            } finally {
            try {
                if (os!=null) {
                    os.close();
                }
                if(socket!=null) {
                    socket.close();
                }
            } catch (IOException e1) {
                e1.printStackTrace();
            }

        }

    }

    public static void main(String[] args) {
        new Serverdl();
    }
}
